nodeJS & friends; updating

2018-05-21

A post I've had floating about-- updating npm/node and all that jazz.

updating npm

reference: npm

npm install npm@latest -g

for mac, needed sudo

updating nodeJS

reference: nodeJS docs

stackoverflow post

UPDATED SO snippet:

2019 Solution Without using sudo!

The Stable "LTS" version of node is 10.15.0 (2019-01-13) see: nodejs.org for latest.
Step 1 - Get NVM (Node Version Manger)

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

    If you're curious about the installation command read the source code
    ... its been reviewed by several security experts

Step 2 - Install the version of node.js you need

Once you've got NVM you can install a specific version of Node.js using the nvm command:

nvm install v10.15.0

Note: you may need to close & re-open your terminal window for nvm command to be available.

You should expect to see something like this in your terminal:

Now using node v10.15.0

Initial post below:

2017 Solution Without sudo!

The Current/Stable "LTS" version of node is 8.9.4 (2018-01-24) see: nodejs.org for latest.
Step 1 - Get NVM (Node Version Manger)

`curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash`

    If you're curious about the installation command read the source code
    ... its been reviewed by several security experts

Step 2 - Install the version of node.js you need

Once you've got NVM you can install a specific version of Node.js using the nvm command:

nvm install v8.9.4

once in project folder npm install installs dependencies

NOTE: to SWITCH between NODE VERSIONS nvm use [insert version here] or ie: (at the time of initial post) nvm use v8.9.4 I noticed every time i got back into my vagrant box node was back to w.e version it was b4 upgrading, then it would say version was already installed so I looked up how to switch versions

Trying to prevent node version reverting to an older version every time I run a new terminal: nvm use default after setting 8.9.4 as default => $ nvm alias default 8.9.4 restarting reverts version

multiple node versions

Run nvm ls to see list of versions

Run nvm uninstall 5.0.0 to remove version, replacing the 5.0.0 I have with whatever version you want removed.

This particluar post, a few years old, but covers most of what I've found prior/written about in previous sections. The reason I throw it in here is because it gave me my nvm uninstall I was looking for annnnd seems like a sweet blog to revisit :)

nvm + nvm woes

reference: nvm doc

SO post - nvm install; command not found

zsh-nvm plugin doc

For me, nvm not being found was a bit odd as I've used it before-- however, I realized that I had started using Oh My Zsh and in using that you gotta toss 'nvm' into your plugins. Once I did that I checked for it using nvm ls and sure enough not found-- no more!

Something to keep in mind when looking for the .zshrc file, it may be hidden, files starting with . usually are.

Unhide/Hide Files

To unhide/hide: (I'm on a mac) - Put defaults write com.apple.Finder AppleShowAllFiles YES in the terminal, press enter - Relaunch Finder: (alt right-click on Finder icon, select Relaunch) should unhide hidden files

Once you're done and would like to re-hide them: - Put defaults write com.apple.Finder AppleShowAllFiles NO, press enter - Relaunch Finder: (alt right-click on Finder icon, select Relaunch) should again hide files


← go back